package com.xuecheng.manage_cms.web.controller;

import com.xuecheng.api.cms.CmsTemplateControllerApi;
import com.xuecheng.framework.domain.cms.CmsTemplate;
import com.xuecheng.framework.model.response.QueryResponseResult;
import com.xuecheng.framework.model.response.ResponseResult;
import com.xuecheng.manage_cms.service.TemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/cms/template")
public class CmsTemplateController implements CmsTemplateControllerApi {

    @Autowired
    private TemplateService templateService;

    @GetMapping("/list")
    @Override
    public QueryResponseResult findList() {
        return templateService.findList();
    }

    @PostMapping("/add")
    public ResponseResult add(String path, @RequestBody CmsTemplate cmsTemplate){
        return templateService.add(path,cmsTemplate);
    }
    @DeleteMapping("/del/{templateId}")
    public ResponseResult del(@PathVariable("templateId") String templateId){
        return templateService.del(templateId);
    }

}
